package cn.lzm.feign;

import cn.lzm.AjaxResult;
import cn.lzm.domain.Store;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class StoreFeignClientFallbackFactory implements FallbackFactory<StoreFeignClient> {

    @Override
    public StoreFeignClient create(Throwable throwable) {
        return new StoreFeignClient() {
            @Override
            public AjaxResult addOne(Store store) {
                return AjaxResult.me().setSuccess(false).setMessage("熔断开启！请重试！！");
            }

        };
    }
}
